<template>
  <div id="home">
    <!--小导航-->
    <sub-nav-com :company="data"></sub-nav-com>
    <!--专科-->
    <feature-com v-if="data.departments && data.departments.length" :title="{ch:'科室介绍',en:'SUBJECTS'}" :list="data.departments"></feature-com>
   <!--新闻动态预视频中心-->
    <div v-if="data.videos" class="news-and-video row">
      <div  v-if="data.videos.length>0" class="col col-12 col-md-12 col-lg-6">
        <news-com :data="data.dongtai" :title="{ch:'新闻动态',en:'DYNAMIC'}"></news-com>
      </div>
      <div v-if="data.videos.length>0"  class="co col-12 col-md-12 col-lg-6">
        <video-com :data="data.videos" :title="{ch:'视频中心',en:'VEDIO'}"></video-com>
      </div>
    </div>
    <!--专家-->
    <specialist-com v-if="data.employees && data.employees.length" :company="company" :title="{ch:'专家团队',en:'PROFESSORS'}" :employees="data.employees"></specialist-com>
    <!--设备-->
    <device-com v-if="data.equipments && data.equipments.length" :title="{ch:'尖端设备',en:'EQUIPMENT'}" :list="data.equipments"></device-com>
    <!--环境-->
    <div v-if="data.data">
      <environment-com  v-if="data.data.environment && data.data.environment.length" :title="{ch:'医院环境',en:'ENVIRONMENT'}" :list="data.data.environment"></environment-com>
    </div>

    <!--案例-->
    <case-com v-if="data.cases && data.cases.length" :title="{ch:'案例',en:'CASE'}" :list="data.cases"></case-com>
  </div>

</template>

<script>
  import subNavCom from "./subNavCom"
  import featureCom from "./featureCom"
  import specialistCom from "./specialistCom"
  import deviceCom from "./deviceCom"
  import environmentCom from "./environmentCom"
  import caseCom from "./caseCom"
  import NewsCom from "./newsCom";
  import VideoCom from "./videoCom";

  export default {
    computed: {},
    data() {
      return {
        data: {},
        company: {}
      }
    },
    components: {
      VideoCom,
      NewsCom,
      subNavCom,
      featureCom,
      specialistCom,
      environmentCom,
      deviceCom,
      caseCom
    },
    mounted() {
      this.getHome()
    },
    methods: {
      getHome() {
        this.getHttpObject()
          .setApi('home')
          .onSucc((res)=>{
            let data = res.data.data;
            this.dlog('收到的首页部数据:')
            this.dlog(data)
            this.data = data
            this.company = this.data.company
          }).goAxios()
      },
    }
  }
</script>

<style lang="less" scoped>
  @import "~assets/style/public";

  * {
    margin: 0;
    padding: 0;
  }

  ul, ol, li {
    list-style: none;
  }

  @media (min-width:320px) and (max-width: 767px) {

  }

  .news-and-video{
    margin-top: 50/@size;
  }

</style>
